from django.shortcuts import render
from django.http import HttpResponse,JsonResponse
# Create your views here.
from django.views import View

from homes.models import House
from .models import Area
class CityView(View):
    #城区模块
    def get(self,request):
        city_list=Area.objects.all()
        data=[]
        for city in city_list:
            data.append({
                'aid':city.id,
                'aname':city.name
            })
        return JsonResponse({
                "errmsg": "获取成功",
                "errno": "0",
                "data":data
        })






